package com.hxk.ioText.charIo.nodeIo;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class FileIo {

	public static void main(String[] args) {
		FileReader fr = null;
		FileWriter fw = null;
		try {
			fr = new FileReader("d:/textio.txt");
			fw = new FileWriter("d:/textio1.txt");
			char[] cbuf = new char[1024];
			int len = fr.read(cbuf);
			while(len != -1) {
				fw.write(cbuf, 0, len);
				len = fr.read(cbuf);
			}
		}catch (Exception e) {
			e.printStackTrace();
		}finally {
			try {
				if(fr != null) {
					fr.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
			try {
				if(fw != null) {
					fw.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}
